import java.util.*;
public class Solution {
    public static int MoreThanHalfNum_Solution(int [] array) {
            int length=array.length;
            if(array==null||length<=0){
                return 0;
            }
            if(length==1){
                return array[0];
            }
            int[] tempArray=new int[length];
            for(int i=0;i<length;i++){
                tempArray[i]=array[i];
            }
        for(int i=0;i<length-1;i++){
            if(array[i]==0){
                continue;
            }
            for(int j=i+1;j<length;j++){
                if(array[i]!=array[j]&&array[j]!=0){
                    array[i]=0;
                    array[j]=0;
                    break;
                }
            }
        }
        int ret =0;
        for(int i=0;i<length;i++){
            if(array[i]!=0){
               ret=array[i];
                break;
            }
        }
        return ret;
    }

    public static void main(String[] args) {
        int[] arr={9};
        System.out.println(MoreThanHalfNum_Solution(arr));
    }
}